package com.situ.day12;

public class MyException extends Exception{
	
	//还差多少钱
	private Double money;
	
	
	public MyException(Double money) {
		super("余额不足还差："+money);
		this.money = money;
	}
	
	private double getMoney() {
		return 0;
	}

	public static void main(String[] args) {
		MoneyManager moneyManager = new MoneyManager(1000.0, "001");
				moneyManager.deposite(600);
				try {
					moneyManager.withdraw(1001);
				} catch (MyException e1) {
					e1.printStackTrace();
					  // 在界面上给用户弹出一个提示，显示余额不足
				    double money = e1.getMoney();
				    System.out.println("还需要" + money);
				}
				try {
					moneyManager.withdraw(600);
				} catch (MyException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
	}

	
}
